import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class FlutterPage extends StatefulWidget {
  @override
  _ScreenState createState() => _ScreenState();
}

class _ScreenState extends State<FlutterPage> {

  @override
  void initState() {
    super.initState();
  }
  final _platform =const MethodChannel('samples.flutter.dev/router');
  Future<void> _routerNative() async{
    try{
      await _platform.invokeMethod<int>('routerNative');
    } on PlatformException catch(e){
      print("channel 失效");
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('flutter')),
      floatingActionButton: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          FloatingActionButton(
            child: Text('跳转'),
              onPressed: () => _routerNative()
          ),
        ],
      )

    );
  }

  @override
  void dispose() {
    super.dispose();
  }
}